home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 December / december_2000.iso / Intercd / root / Mail / ^MailShield / setup.exe / data1.cab / Default_Rule_Files / mailfrom.mml < prev    next >
Encoding:
Text File  |  2000-10-18  |  3.0 KB  |  89 lines

  1. ##############################################################################
  2. # mailfrom.mml 
  3. #
  4. # MailShield script that is run after the MAIL FROM:<> SMTP command
  5. #
  6.  
  7. ##############################################################################
  8. # (optional) log this MAIL FROM message
  9. #
  10. #   &LogMessage("SMTP MAIL FROM from: '".$SmtpMailFrom."'");
  11.  
  12.  
  13. ##############################################################################
  14. # If this host has been accepted for relaying in begin.mml, the perform no more tests
  15.  
  16.     if ($accept) {
  17.         exit;
  18.     };
  19.  
  20.  
  21. ##############################################################################
  22. # check the MAIL FROM to see if on the special approved list.
  23.     if (scalar(@ok_mail_from) > 0) { 
  24.         if (index(lc($SmtpMailFrom), @ok_mail_from) > -1) { 
  25.             $accept = TRUE;
  26.             &MessageAppend(" (your MAIL FROM address approves you for relaying)");
  27.             exit;
  28.         }; 
  29.     }; 
  30.  
  31.  
  32. ##############################################################################
  33. # Sleep for a number of seconds if we have been instructed to tarpit this connection.
  34.  
  35.     if ($tarpit) {
  36.         sleep($tarpit_delay);
  37.     };
  38.  
  39.  
  40. ##############################################################################
  41. # check for banned MAIL FROM text
  42.  
  43.     if (scalar(@banned_mail_from) > 0) { 
  44.         if (index(lc($SmtpMailFrom), @banned_mail_from) > -1) { 
  45.             $smtp_message = "550 SMTP session aborted;";
  46.             $log_message = "550 MAIL FROM of '".$SmtpMailFrom."' is banned / matched ".$match;
  47.             &DefaultRejection;
  48.         };
  49.     };
  50.  
  51.  
  52. ##############################################################################
  53. # (optional) reject messages with no MAIL FROM, (bounce reports and error
  54. # mail come in this way)
  55.  
  56.     if ($reject_empty_mail_from) {
  57.         if (length($SmtpMailFrom) == 0) { 
  58.             $smtp_message = "550 SMTP session aborted;";
  59.             $log_message = "550 MAIL FROM is not allowed to be empty";
  60.             &DefaultRejection;
  61.         };
  62.     };
  63.  
  64.  
  65. ##############################################################################
  66. # (optional) reject messages with source-routed addresses
  67.  
  68.     if ($reject_routed_email) {
  69.         if (index($SmtpMailFrom, "%") > -1) {
  70.             $smtp_message = "550 SMTP session aborted due to source-routing";
  71.             $log_message = "550 Source routing not allowed.  MAIL FROM was: '".$SmtpMailFrom."').";
  72.             &DefaultRejection;
  73.         };
  74.     };
  75.  
  76.  
  77. ##############################################################################
  78. # check to make sure that the From: address appears to be in a valid syntax
  79.  
  80.     if ($reject_invalid_mail_from) {
  81.         if ((length($SmtpMailFrom) > 0) && (!&EmailAddressValid($SmtpMailFrom))) {
  82.             $smtp_message = "550 Invalid MAIL FROM";
  83.             $log_message = "550 Invalid email address in MAIL FROM: '".$SmtpMailFrom."'";
  84.             &DefaultRejection;
  85.         };
  86.     };
  87.  
  88.  
  89.